package note1.chapters.chapter5;

class Book {
	boolean checkedOut = false;

	public Book(boolean checkedOut) {
		this.checkedOut = checkedOut;
	}

	void checkIn() {
		this.checkedOut = false;
	}

	@Override
	protected void finalize() throws Throwable {
		if (checkedOut) {
			System.out.println("Error Checked Out");
			super.finalize();
		}
	}
}

public class TerminationCondition {

	public static void main(String[] args) {
		Book book = new Book(true);
		book.checkIn();
		new Book(true);
		System.gc();
	}

}
